<div class="subscribe_btn_div">
    <a class="subscribe_btn" href="javascript:"> 订阅 </a>

    <div id="frame_subscribe">
        <input id="email_address" name="email_address" type="text" class="form-control form_check pull-left" placeholder="输入email地址"
               style="width: 200px;" required>
        <button id="dingyue_btn" class="btn btn-default" style="width: 70px;">提交</button>
    </div>
</div>


<style>
    .subscribe_btn, .subscribe_btn_div {
        z-index: 998;
        position: fixed;
        width: 48px;
        bottom: 90px;
        height: 30px;
        line-height: 30px;
        display: block;
        right: 50px;
        text-align: center;
        background-color: rgb(158, 158, 158);
        color: #fff
    }

    a.subscribe_btn:hover {
        background-color: rgb(133, 133, 133);
        color: #fff
    }

    #frame_subscribe {
        position: absolute;
        bottom: -24px;
        right: 58px;
        background-color: rgb(158, 158, 158);;
        width: 300px;
        padding: 10px 0 10px 10px;
        display: none
    }
</style>
<script>
    $(function () {
        $('.subscribe_btn').click(function (e) {
            $('#frame_subscribe').toggle();
        })
        $('#dingyue_btn').click(function () {


            var patterns = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
            var email_address = $('#email_address').val();
            if (email_address == '' || !patterns.test(email_address)) {
                toast.error('请输入正确的邮箱格式');
            }
            else {
                $.post("{:addons_url('Mail://Mail/subscribe')}", {email_address: email_address}, function (res) {
                    if (res.status) {
                        toast.success(res.info);
                        $('#email_address').val('');
                        $('#frame_subscribe').hide();
                    } else {
                        toast.error(res.info);
                    }
                }, 'json')
            }

        })
    })


</script>